import { createWebHistory, createRouter } from 'vue-router'

// 引入组件
import Home from '../view/Home/index.vue'
import Login from '../view/Login/index.vue'
import Layout from '../view/Layout/index.vue'
// import Prodece from '../view/Prodece/index.vue'
import Dashboard from '../view/Home/Dashboard/dashboard.vue'
import BannerList from '../view/Home/Banner/bannerList.vue'

// 配置路由规则
export const routes = [
  {
    path: '/',
    redirect: '/home', //重新指定路径
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/home',
        component: Home,
        name: 'home',
        redirect: '/home/dashboard',
        children: [
          { path: 'dashboard', component: Dashboard, name: 'dashboard' },
          { path: 'banner/list', component: BannerList, name: 'bannerList' }
        ]
      },
      { path: '/login', component: Login, name: 'login' }
    ]
  }
]

// 创建路由对象
const router = createRouter({
  history: createWebHistory(),
  routes
})
export default router
